// 二叉树遍历
var levelOrder = function(root) {
    if(!root) 
    return [];
     let res = [];
    let arr = [root];
    while(arr.length) {
        let list = [];
       let n = arr.length;
       for(let i = 0;i<n;i++) {
            let node = arr.shift();
            list.push(node.val);
            if(node.left!=null)
            arr.push(node.left)
            if(node.right!=null)
            arr.push(node.right)
       }
       res.push(list);
    }
    return res;
};